package com.healMyself.service.impl;

import com.healMyself.dao.RecordDao;
import com.healMyself.dao.impl.RecordDaoImpl;
import com.healMyself.pojo.Record;
import com.healMyself.service.RecordService;
import com.healMyself.util.C3p0Conn;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;

public class RecordServiceImpl implements RecordService {
    private RecordDao dao = new RecordDaoImpl();

    /**
     * 添加服药记录
     * @param record
     * @return
     */
    @Override
    public int addRecord(Record record) {
        return dao.addRecord(record);
    }

    /**
     * 按条件查询服药记录
     * @param medicine
     * @param statTime
     * @param Deadline
     * @param place
     * @return
     */
    @Override
    public List<Record> queryRecord(int userId, String medicine, Timestamp statTime, Timestamp Deadline, String place) {
        return dao.queryRecord(userId, medicine, statTime, Deadline, place);
    }
}
